package com.x86.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.x86.domain.Batch;
import com.x86.domain.ComputerVO;
import com.x86.domain.DayDetail;
import com.x86.mapper.BatchMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.x86.mapper.ComputerMapper;
import com.x86.domain.Computer;
import com.x86.service.ComputerService;

/**
 * @author 风亦未止
 * @date 2022/4/10 19:27
 */
@Service
public class ComputerServiceImpl extends ServiceImpl<ComputerMapper, Computer> implements ComputerService {
    @Autowired
    public ComputerMapper computerMapper;

    @Autowired
    public BatchMapper batchMapper;

    @Override
    public PageInfo<ComputerVO> getList(int pageSize, int pageNum) {
        return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> {
            computerMapper.getAll();
        });
    }

    @Override
    public PageInfo<ComputerVO> getComInfoByBatch(int pageSize, int pageNum, Batch batch) {
        return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> {
            batchMapper.getComInfoByBatch(batch);
        });
    }

    @Override
    public Integer getComListBy7day() {
        return computerMapper.getComListBy7day();
    }

    @Override
    public List<DayDetail> getDayDetail() {
        return computerMapper.getDayDetail();
    }
}

